package com.icode.web.controller.User;

import com.icode.core.dto.user.UserDTO;
import com.icode.service.user.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.ModelAndView;

/**
 * Created with IntelliJ IDEA.
 * User: sunk
 * Date: 14-12-26
 * Time: 下午4:12
 * To change this template use File | Settings | File Templates.
 */
@Controller
@RequestMapping("/login")
public class LoginController {
    @Autowired
    private UserService userService;

    @RequestMapping(value = "form", method = RequestMethod.GET)
    private ModelAndView showLoginForm() {
        return new ModelAndView("front/user/login", "loginDTO", new UserDTO());
    }


    /**
     * 前台登录
     *
     * @return
     */
    @RequestMapping(value = "/login", method = RequestMethod.GET)
    public String frontendLogin() {
        return "front/user/login/form";
    }

    /**
     * 后台登录
     *
     * @return
     */
    @RequestMapping(value = "/logon", method = RequestMethod.GET)
    public String backendLogin() {
        return "back/logon";
    }

    /**
     * 后台登录成功后欢迎页面
     *
     * @return
     */
    @RequestMapping(value = "/welcome", method = RequestMethod.GET)
    public String backendWelcome() {
        return "back/welcome";
    }

    /**
     * 登录成功但无权限访问时展示的页面
     *
     * @return
     */
    @RequestMapping(value = "/deny", method = RequestMethod.GET)
    public String deny() {
        return "deny";
    }

    @RequestMapping(value = "forgetPassWord")
    public String forgetPassWord(){

        return "front/user/resetting";
    }

}
